﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Zamena_min_na_max
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "good morning to you";
            string[] words = s.Split(' ');
            string min = words[0];
            string max = words[0];
            for (int i = 0; i < words.Length; i++)
            {
                if (max.Length < words[i].Length)
                {
                    max = words[i];
                }

                if (min.Length > words[i].Length)
                {
                    min = words[i];
                }
            }
            for (int i = 0; i < words.Length; i++)
            {
                if (words[i] == max)
                {
                    words[i] = min;
                    i++;
                }

                if (words[i] == min)
                {
                    words[i] = max;

                }
            }
            foreach (var i in words)
            {
                Console.Write(i + " ");
            }
        }
    }
}